package com.sunagy.demand.backend.security;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.Assert;

/**
 * desc：#TODO fill me ！
 * author：三餘無夢生
 * date：2018/4/26
 * time：下午4:39
 */
public final class MyGrantedAuthority implements GrantedAuthority {
    private static final long serialVersionUID = 410L;
    private String authority;

    public MyGrantedAuthority() {
    }

    public MyGrantedAuthority(String authority) {
        Assert.hasText(authority, "A granted authority textual representation is required");
        this.authority = authority;
    }

    public String getAuthority() {
        return this.authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else {
            return obj instanceof MyGrantedAuthority ? this.authority.equals(((MyGrantedAuthority)obj).authority) : false;
        }
    }

    public int hashCode() {
        return this.authority.hashCode();
    }

    public String toString() {
        return this.authority;
    }
}

